package lab02.test17;

public class Test {
    public static void main(String[] args) {
        int[] numbers = new int[10];
        numbers[0] = 156;
        numbers[1] = 44;
        numbers[2] = 331;
        numbers[3] = 53;
        numbers[4] = 3444;
        numbers[5] = 65;
        numbers[6] = 46;
        numbers[7] = 63;
        numbers[8] = 96;
        numbers[9] = 155;
        int index;
        int max;
        int min;
        int g = 0;
        int t=0;
        max = min = numbers[0];
        for (index = 0; index < numbers.length; index++) {
            System.out.println(numbers[index]);
            if (numbers[index] > max) {
                max = numbers[index];
                g = index+1;
            }
            if (numbers[index] < min) {
                min = numbers[index];
                t = index+1;

            }
        }
            System.out.println("最大值是：" + max);
            System.out.println("最大值的位置是" + g+"位");
            System.out.println("最小值是：" + min);
            System.out.println("最小值的位置是第" + t+"位");
            //总和
            int sum = 0;
            int i;
            for (i = 0; i < numbers.length; i++) {
                sum += numbers[i];
            }
            System.out.println("总和是：" + sum);
            System.out.println();
            //最大值和最小值在该数组中的位置
        }
    }

